<?php

namespace App\WeChat;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Site;
use App\Models\WeChat as Model;
use Houdunwang\WeChat\Message\Message;

class ApiController extends Controller
{
    public function handle(Request $request, Site $site, Model $model, Message $message)
    {
        $message->init($model);
//文本消息
        $content = $message->text($message->Content);
        return $message->text(site()->title);
        //图文消息
//        $content = $message->news([
//            ['title' => '视觉盛宴', 'description' => '一栏美食', 'url' => 'https://www.yhdengdeng.net/kind/index', 'pic' => 'https://images.unsplash.com/photo-1425321505542-00715f6a9c28?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=300&ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjIyMDAyNzgx&ixlib=rb-1.2.1&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=300']
//        ]);
        return $content;
    }
}
